home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Applications / Graphics / nxyplot / Source / ScrollWindow.m < prev    next >
Text File  |  1992-07-30  |  2KB  |  56 lines

  1. #import "ScrollWindow.h"
  2. #import <appkit/nextstd.h>
  3. #import <appkit/ScrollView.h>
  4.  
  5. @implementation ScrollWindow
  6.  
  7. - becomeScrollWindow
  8. {
  9.   id newContent;
  10.  
  11. //  newContent = [ScrollView new];
  12.   newContent = [[ScrollView alloc] init];
  13.   [newContent setAutosizing:(NX_WIDTHSIZABLE | NX_HEIGHTSIZABLE)];
  14.   [newContent setDocView:[self setContentView:newContent]];
  15.   return self;
  16. }
  17.  
  18. - setMinFrameSize:(NXSize) newSize
  19. {
  20.   minFrameSize = newSize;
  21.   return self;
  22. }
  23.  
  24. - windowWillResize:sender toSize:(NXSize *)frameSize
  25. {
  26.   NXRect contentRect, maxFrameRect;
  27.  
  28.   [[[self contentView] docView] getBounds:&contentRect];
  29.   [ScrollWindow getFrameRect:&maxFrameRect
  30.                 forContentRect:&contentRect style:[self style]];
  31.   frameSize->width = MIN(frameSize->width, maxFrameRect.size.width);
  32.   frameSize->height = MIN(frameSize->height, maxFrameRect.size.height);
  33.   frameSize->width = MAX(frameSize->width, minFrameSize.width);
  34.   frameSize->height = MAX(frameSize->height, minFrameSize.height);
  35.   return self;
  36. }
  37.  
  38. - windowDidResize:sender
  39. {
  40.   NXRect contentRect, maxFrameRect;
  41.  
  42.   [[[self contentView] docView] getBounds:&contentRect];
  43.   [ScrollWindow getFrameRect:&maxFrameRect
  44.                 forContentRect:&contentRect style:[self style]];
  45.   if ((frame.size.width < maxFrameRect.size.width)
  46.        || (frame.size.height < maxFrameRect.size.height))
  47.     [[[self contentView] setHorizScrollerRequired:YES] setVertScrollerRequired:YES];
  48.   else
  49.     [[[self contentView] setHorizScrollerRequired:NO] setVertScrollerRequired:NO];
  50.  
  51.   return self;
  52. }
  53.  
  54. @end
  55.  
  56.